import requests from './request.js';

// 点击登陆
export const getLoginUserInfoByToken = () => requests({
    url: `/personal/getLoginUserInfoByToken?token=${localStorage.getItem('token')}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token')
    }
});

// 更新当前用户的头像
export const updateUserAvatar = (avatarUrl) => requests({
    url: `/personal/updateUserAvatar?avatarUrl=${avatarUrl}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token')
    }
});

// 更新当前用户的背景
export const updateUserBg = (bgUrl) => requests({
    url: `/personal/updateUserBg?bgUrl=${bgUrl}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token')
    }
});

// 查询是否有相同的用户名
export const isSimpleUserName = (userName) => requests({
    url: `/personal/isSimpleUserName?userName=${userName}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token')
    }
});

// 更新当前登陆用户的用户名和昵称
export const updateCurrentUserNameAndNickName = (params) => requests({
    url: `/personal/updateCurrentUserNameAndNickName`,
    method: 'post',
    data: params,
    headers: {
        token: localStorage.getItem('token')
    }
});